
import axios from '@/libs/axios1';
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' };
let baseUrl = '/scientific/userTask';

//查询
export const queryTaskTree = (contentId) => {
    return axios({
        url: `${baseUrl}/all/${contentId}`,
        method: 'GET',
        params: {},
        headers: jsonHeaders,
    });
};

//查询任务列表
export const queryTaskList = (contentId,params) => {
    return axios({
        url: `${baseUrl}/base/${contentId}`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};


// 添加
export const addTask = (data) => {
    return axios({
        url: `${baseUrl}`,
        method: 'POST',
        data,
        headers: jsonHeaders,
    });
};

// 修改
export const updateTask = (id,data) => {
    return axios({
        url: `${baseUrl}/${id}`,
        method: 'PUT',
        data,
        headers: jsonHeaders,
    });
};

// 删除
export const delTask = (id) => {
    return axios({
        url: `${baseUrl}/${id}`,
        method: 'DELETE',
        headers: jsonHeaders,
    });
};

//开始
export const startTask = (id) => {
    return axios({
        url: `${baseUrl}/start/${id}`,
        method: 'PUT',
        headers: jsonHeaders,
    });
};

//单位设计师查询分配给自己的任务
export const queryUserTask = (params) => {
    return axios({
        url: `${baseUrl}/page`,
        method: 'GET',
        params,
        headers: jsonHeaders,
    });
};

export const queryUserTaskStatistics = (contentId) => {
    return axios({
        url: `${baseUrl}/statistics/${contentId}`,
        method: 'GET',
        params:{},
        headers: jsonHeaders,
    });
};